package com.light.lallalalalal;

import java.util.ArrayList;

import org.anddev.andengine.engine.handler.IUpdateHandler;
import org.anddev.andengine.extension.physics.box2d.PhysicsWorld;

import com.badlogic.gdx.math.Vector2;

public class MyPhysicsWorld extends PhysicsWorld{
	
	public ArrayList<IUpdateHandler> updateList = new ArrayList<IUpdateHandler>();
	
	public void registeUpdateHandler(IUpdateHandler handler)
	{
		updateList.add(handler);
	}
	
	public void unregisteUpdateHandler(IUpdateHandler handler)
	{
		updateList.remove(handler);
	}
	
	public MyPhysicsWorld(Vector2 pGravity, boolean pAllowSleep) {
		super(pGravity, pAllowSleep);
		// TODO Auto-generated constructor stub
	}
	
	@Override
	public void onUpdate(float time)
	{
		super.onUpdate(time);
		for (int i = 0; i < updateList.size(); i++)
		{
			updateList.get(i).onUpdate(time);
		}
	}

}
